---
title: "London"
output:
flexdashboard::flex_dashboard:
theme:
version: 4
primary: "white"
navbar-bg: "#002231"
source_code: embed
---
```{r setup, include=FALSE}
library(dygraphs)
library(xts)
library(lubridate)
library(dplyr)
library(tidyr)
library(leaflet)
library(sp)
library(raster)
library(mapview)
library(leafsync)
library(glue)
library(htmltools)
#author: Wanda Bodnar
## Data sources:
#https://climate.metoffice.cloud/dashboard.html,
#https://www.metoffice.gov.uk/pub/data/weather/uk/climate/datasets/Tmean/date/UK.txt,
#https://www.metoffice.gov.uk/pub/data/weather/uk/climate/stationdata/heathrowdata.txt,
##https://www.kaggle.com/datasets/noahx1/london-weather-2000-2023,
#https://psmsl.org/data/,
#https://www.sciencedirect.com/science/article/pii/S0079661121000112?via%3Dihub#s0180,
#https://uk-cri.org/
```
Row {data-height=500}
-------------------------------------
### Annual maximum and minimum air temperature
```{r}
setwd("C:/Users/bodna/OneDrive - University College London/Roadmap to Climate Resilience/Working folder/Data/Various")
london <- read.csv("london.csv")
london_monthly_combined <- london %>%
group_by(year) %>%
summarise(across(c(tmax, tmin), mean, na.rm=TRUE))
dygraph(london_monthly_combined, main = "") %>%
dySeries("tmax", label = "Max temperature", color = "red") %>%
dySeries("tmin", label = "Min temperature", color = "blue") %>%
dyAxis("y", label = "Temperature (°C)") %>%
dyLegend(show = "always", hideOnMouseOut = T) %>%
dyRangeSelector()
```
### Annual mean precipitation
```{r}
setwd("C:/Users/bodna/OneDrive - University College London/Roadmap to Climate Resilience/Working folder/Data/Various")
london <- read.csv("london.csv")
london_monthly_combined <- london %>%
group_by(year) %>%
summarise(across(c(rain_mm), mean, na.rm=TRUE))
dygraph(london_monthly_combined, main = "") %>%
dySeries("rain_mm", label = "mm", color = "darkblue") %>%
dyAxis("y", label = "Rain (mm)") %>%
dyOptions(fillGraph = TRUE, fillAlpha = 0.1) %>%
dyLegend(show = "always", hideOnMouseOut = T) %>%
dyRangeSelector()
```
### Annual mean wind speed
```{r}
setwd("C:/Users/bodna/OneDrive - University College London/Roadmap to Climate Resilience/Working folder/Data/Various")
wind <- read.csv("wind.csv")
wind_combined <- wind %>%
group_by(Year) %>%
summarise(across(c(wspd), mean, na.rm=TRUE))
dygraph(wind_combined, main = "") %>%
dySeries("wspd", label = "km/h", color = "green") %>%
dyAxis("y", label = "Wind speed (km/h)") %>%
dyOptions(fillGraph = TRUE, fillAlpha = 0.1) %>%
dyLegend(show = "always", hideOnMouseOut = T) %>%
dyRangeSelector()
```